<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        //      你如何获取浏览器URL中查询字符串中的参数?

        // 测试地址为:
        // http://www.runoob.com/jquery/misc-trim.html?channelid=12333&name=xiaoming&age=23
        function showWindowHref() {
        var sHref = window.location.href;
        var args = sHref.split('?');

        if (args[0] == sHref) {

            return "";
        }
        var arr = args[1].split('&');
        var obj = {};

        for (var i = 0; i < arr.length; i++) {
            var arg = arr[i].split('=');

            obj[arg[0]] = arg[1];
        }

            return obj;
        
        }
        var href = showWindowHref(); // obj
        console.log(href['name']); // xiaoming
    </script>


</body>

</html>